package com.hyh.service;

import android.app.ActivityManager;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.IBinder;
import android.os.SystemClock;
import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
import android.util.Log;

import com.hyh.util.ServiceUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2019/1/28.
 */

public class ProtectedService extends Service {

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
//        new Thread(new Runnable() {
//            @Override
//            public void run() {
//                while (true){
//                    if(!ServiceUtil.isServiceRunning(ProtectedService.this,CoreService.class.getName())){
//                        Intent intent1 = new Intent(ProtectedService.this,CoreService.class);
//                        startService(intent1);
//                    }
//                    SystemClock.sleep(1000);
//                }
//            }
//        }).start();
        return START_STICKY;
    }
}
